package com.qualityevaluationcloudoauth2.utils;

import org.springframework.security.crypto.password.PasswordEncoder;

/**
 * @program: batteryswapcloudProject
 * @class: MyPasswordEncoder
 * @description: MD5加密类
 * @author: CaoAMan
 * @create: 2021-02-27 10:51
 **/
public class MyPasswordEncoder implements PasswordEncoder {

    @Override
    public boolean matches(CharSequence rawPassword, String encodedPassword) {
        return encodedPassword.equals(MD5Util.encode((String)rawPassword));
    }

    @Override
    public String encode(CharSequence rawPassword) {
        return MD5Util.encode((String)rawPassword);
    }
}